package com.cqk.bigdata.redis;

import redis.clients.jedis.Jedis;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author: add
 * @date: 2018/4/2 14:06
 * @param null
*/

public class JedisTest {
    private static AtomicInteger count = new AtomicInteger(0);
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        for (int i = 0; i <10 ; i++) {
            executorService.execute(new Runnable() {
                @Override
                public void run() {
                    Jedis jedis = JedisUtil.getJedis();
                    jedis.set("count",count.toString());
                    System.out.println("jedis :"+jedis.get("count")+"=="+jedis.hashCode());
                    count.getAndIncrement();
                }
            });
        }


    }
}
